{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  Name   f1  q1  f2   q2  f3  q3   f4   q4   f5    q5\n",
      "0  桂枝汤  炙甘草   2  生姜  3.0  桂枝   3   芍药  3.0   大枣  12.0\n",
      "1  四逆汤  炙甘草   2  干姜  1.5  附子   1  NaN  NaN  NaN   NaN\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>f1</th>\n",
       "      <th>q1</th>\n",
       "      <th>f2</th>\n",
       "      <th>q2</th>\n",
       "      <th>f3</th>\n",
       "      <th>q3</th>\n",
       "      <th>f4</th>\n",
       "      <th>q4</th>\n",
       "      <th>f5</th>\n",
       "      <th>q5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>桂枝汤</td>\n",
       "      <td>炙甘草</td>\n",
       "      <td>2</td>\n",
       "      <td>生姜</td>\n",
       "      <td>3.0</td>\n",
       "      <td>桂枝</td>\n",
       "      <td>3</td>\n",
       "      <td>芍药</td>\n",
       "      <td>3.0</td>\n",
       "      <td>大枣</td>\n",
       "      <td>12.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>四逆汤</td>\n",
       "      <td>炙甘草</td>\n",
       "      <td>2</td>\n",
       "      <td>干姜</td>\n",
       "      <td>1.5</td>\n",
       "      <td>附子</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Name   f1  q1  f2   q2  f3  q3   f4   q4   f5    q5\n",
       "0  桂枝汤  炙甘草   2  生姜  3.0  桂枝   3   芍药  3.0   大枣  12.0\n",
       "1  四逆汤  炙甘草   2  干姜  1.5  附子   1  NaN  NaN  NaN   NaN"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import sys\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "fang = pd.read_csv('hi.csv')\n",
    "print(fang)\n",
    "fang\n",
    "#可以看到,不要用print来显示pandas的csv,而是直接输出,那么就是一个特别规整的csv表形式,这个厉害\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 236,
   "metadata": {},
   "outputs": [],
   "source": [
    "fang1 = pd.read_json('shanghanfang.json')\n",
    "f = fang1.T #這裡翻轉一下子適合人讀,不翻轉的話適合機器讀\n",
    "f #而且用pd读出来的就默认是个dataframe,这个json就是在药方这里内部是一个字典而已,这样感觉操作起来是很方便\n",
    "\n",
    "sh1 = pd.read_json('SH_ty1.json')\n",
    "sh1_t = sh1.T\n",
    "w = pd.read_json('WX_yao.json')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>对应证</th>\n",
       "      <th>药方</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>桂枝汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝加葛根汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝加厚朴杏子汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'厚朴': 4, '杏子': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝加附子汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝去芍药汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'桂枝': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝去芍药加附子汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'桂枝': 3, '附子': 1, '炙甘草': 2, '生姜': 3, '大枣': 12}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝麻黄各半汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'桂枝': 1.7000000000000002, '芍药': 1, '炙甘草': 1, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝二麻黄一汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'桂枝': 1.7000000000000002, '芍药': 1.25, '炙甘草': ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>白虎加人参汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'知母': 6, '石膏': 16, '炙甘草': 2, '粳米': 6, '人参': 3}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝二越婢一汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'桂枝': 0.75, '芍药': 0.75, '炙甘草': 0.75, '生姜': 1,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝去桂加茯苓白术汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'白术': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>甘草干姜汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'炙甘草': 4, '干姜': 2}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芍药甘草汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'芍药': 4, '炙甘草': 4}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>调胃承气汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'大黄': 4, '芒硝': 3, '炙甘草': 2}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>四逆汤</th>\n",
       "      <td>太阳病,等等</td>\n",
       "      <td>{'附子': 1, '炙甘草': 2, '生姜': 1.5}</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               对应证                                                 药方\n",
       "桂枝汤         太阳病,等等    {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}\n",
       "桂枝加葛根汤      太阳病,等等  {'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...\n",
       "桂枝加厚朴杏子汤    太阳病,等等  {'厚朴': 4, '杏子': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...\n",
       "桂枝加附子汤      太阳病,等等  {'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...\n",
       "桂枝去芍药汤      太阳病,等等             {'桂枝': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}\n",
       "桂枝去芍药加附子汤   太阳病,等等    {'桂枝': 3, '附子': 1, '炙甘草': 2, '生姜': 3, '大枣': 12}\n",
       "桂枝麻黄各半汤     太阳病,等等  {'桂枝': 1.7000000000000002, '芍药': 1, '炙甘草': 1, ...\n",
       "桂枝二麻黄一汤     太阳病,等等  {'桂枝': 1.7000000000000002, '芍药': 1.25, '炙甘草': ...\n",
       "白虎加人参汤      太阳病,等等    {'知母': 6, '石膏': 16, '炙甘草': 2, '粳米': 6, '人参': 3}\n",
       "桂枝二越婢一汤     太阳病,等等  {'桂枝': 0.75, '芍药': 0.75, '炙甘草': 0.75, '生姜': 1,...\n",
       "桂枝去桂加茯苓白术汤  太阳病,等等  {'白术': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12...\n",
       "甘草干姜汤       太阳病,等等                                {'炙甘草': 4, '干姜': 2}\n",
       "芍药甘草汤       太阳病,等等                                {'芍药': 4, '炙甘草': 4}\n",
       "调胃承气汤       太阳病,等等                       {'大黄': 4, '芒硝': 3, '炙甘草': 2}\n",
       "四逆汤         太阳病,等等                     {'附子': 1, '炙甘草': 2, '生姜': 1.5}"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>桂枝汤</th>\n",
       "      <th>桂枝加葛根汤</th>\n",
       "      <th>桂枝加附子汤</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>六经</th>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>原文</th>\n",
       "      <td>{'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...</td>\n",
       "      <td>{'对应证原文': ['太阳病，项背强几几，反汗出恶风者，桂枝加葛根汤主之。', '太阳与阳...</td>\n",
       "      <td>{'对应证原文': ['太阳病，发汗，遂漏不止，其人恶风，小便难，四支微急，难以屈伸者，桂枝...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方</th>\n",
       "      <td>{'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}</td>\n",
       "      <td>{'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...</td>\n",
       "      <td>{'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>证</th>\n",
       "      <td>{'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...</td>\n",
       "      <td>{'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}</td>\n",
       "      <td>{'体证': ['大量出汗不止', '怕风', '小便难', '四肢难以屈伸'], '脉证'...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                  桂枝汤  \\\n",
       "六经                            {'阴阳': '阳', '三经': '太阳'}   \n",
       "原文  {'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...   \n",
       "方     {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}   \n",
       "证   {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...   \n",
       "\n",
       "                                               桂枝加葛根汤  \\\n",
       "六经                            {'阴阳': '阳', '三经': '太阳'}   \n",
       "原文  {'对应证原文': ['太阳病，项背强几几，反汗出恶风者，桂枝加葛根汤主之。', '太阳与阳...   \n",
       "方   {'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...   \n",
       "证                 {'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}   \n",
       "\n",
       "                                               桂枝加附子汤  \n",
       "六经                            {'阴阳': '阳', '三经': '太阳'}  \n",
       "原文  {'对应证原文': ['太阳病，发汗，遂漏不止，其人恶风，小便难，四支微急，难以屈伸者，桂枝...  \n",
       "方   {'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...  \n",
       "证   {'体证': ['大量出汗不止', '怕风', '小便难', '四肢难以屈伸'], '脉证'...  "
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>六经</th>\n",
       "      <th>原文</th>\n",
       "      <th>方</th>\n",
       "      <th>证</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>桂枝汤</th>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...</td>\n",
       "      <td>{'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}</td>\n",
       "      <td>{'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝加葛根汤</th>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'对应证原文': ['太阳病，项背强几几，反汗出恶风者，桂枝加葛根汤主之。', '太阳与阳...</td>\n",
       "      <td>{'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...</td>\n",
       "      <td>{'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝加附子汤</th>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'对应证原文': ['太阳病，发汗，遂漏不止，其人恶风，小便难，四支微急，难以屈伸者，桂枝...</td>\n",
       "      <td>{'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...</td>\n",
       "      <td>{'体证': ['大量出汗不止', '怕风', '小便难', '四肢难以屈伸'], '脉证'...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                             六经  \\\n",
       "桂枝汤     {'阴阳': '阳', '三经': '太阳'}   \n",
       "桂枝加葛根汤  {'阴阳': '阳', '三经': '太阳'}   \n",
       "桂枝加附子汤  {'阴阳': '阳', '三经': '太阳'}   \n",
       "\n",
       "                                                       原文  \\\n",
       "桂枝汤     {'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...   \n",
       "桂枝加葛根汤  {'对应证原文': ['太阳病，项背强几几，反汗出恶风者，桂枝加葛根汤主之。', '太阳与阳...   \n",
       "桂枝加附子汤  {'对应证原文': ['太阳病，发汗，遂漏不止，其人恶风，小便难，四支微急，难以屈伸者，桂枝...   \n",
       "\n",
       "                                                        方  \\\n",
       "桂枝汤       {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}   \n",
       "桂枝加葛根汤  {'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...   \n",
       "桂枝加附子汤  {'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...   \n",
       "\n",
       "                                                        证  \n",
       "桂枝汤     {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...  \n",
       "桂枝加葛根汤                {'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}  \n",
       "桂枝加附子汤  {'体证': ['大量出汗不止', '怕风', '小便难', '四肢难以屈伸'], '脉证'...  "
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1_t"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "所以根据这个结构,\n",
    "那么程序就好弄了\n",
    "用户输入的就是对应症这里的东西\n",
    "然后根据证找到对应的方剂,结束了\n",
    "这是所谓自己查病治病\n",
    "\n",
    "当然,查一个具体的药的信息\n",
    "以及统计全局信息,对比信息也非常好弄了\n",
    "只要把json的结构设计好,对应好伤寒论,主要是根据六经来区分,随后统计的话是根据五行\n",
    "基本上就差不多了\n",
    "于是不管是学习伤寒论,用伤寒论,统计伤寒论,破解伤寒论都可以进行了"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Name    桂枝汤\n",
       "f1      炙甘草\n",
       "q1        2\n",
       "f2       生姜\n",
       "q2        3\n",
       "f3       桂枝\n",
       "q3        3\n",
       "f4       芍药\n",
       "q4        3\n",
       "f5       大枣\n",
       "q5       12\n",
       "Name: 0, dtype: object"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fang.loc[0]#定位具体行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    桂枝汤\n",
       "1    四逆汤\n",
       "Name: Name, dtype: object"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fang.Name#定位列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'桂枝汤'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fang.Name.loc[0]#感觉这个比较好用,对于精准定位某一个具体数据,先定位列,再是行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>f1</th>\n",
       "      <th>q1</th>\n",
       "      <th>f2</th>\n",
       "      <th>q2</th>\n",
       "      <th>f3</th>\n",
       "      <th>q3</th>\n",
       "      <th>f4</th>\n",
       "      <th>q4</th>\n",
       "      <th>f5</th>\n",
       "      <th>q5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>桂枝汤</td>\n",
       "      <td>炙甘草</td>\n",
       "      <td>2</td>\n",
       "      <td>生姜</td>\n",
       "      <td>3.0</td>\n",
       "      <td>桂枝</td>\n",
       "      <td>3</td>\n",
       "      <td>芍药</td>\n",
       "      <td>3.0</td>\n",
       "      <td>大枣</td>\n",
       "      <td>12.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>四逆汤</td>\n",
       "      <td>炙甘草</td>\n",
       "      <td>2</td>\n",
       "      <td>干姜</td>\n",
       "      <td>1.5</td>\n",
       "      <td>附子</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Name   f1  q1  f2   q2  f3  q3   f4   q4   f5    q5\n",
       "0  桂枝汤  炙甘草   2  生姜  3.0  桂枝   3   芍药  3.0   大枣  12.0\n",
       "1  四逆汤  炙甘草   2  干姜  1.5  附子   1  NaN  NaN  NaN   NaN"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fang.head()#如果是一个大列表,看一下开头"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "#s1 = fang.query('炙甘草')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2, 11)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fang.shape#看一下整体结构的数据统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2, 15)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fang1.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "对应证                                             太阳病,等等\n",
       "药方     {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}\n",
       "Name: 桂枝汤, dtype: object"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fang1.桂枝汤#一秒找到该方剂的对应信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fang1.桂枝汤[1]#随后是该方剂内部的分类信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'太阳病,等等'"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f.对应证[14]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fang1.桂枝汤[1]['桂枝']#定位到字典后查询字典中的数据,这里是查询具体一味药的药量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4, 3)"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>桂枝汤</th>\n",
       "      <th>桂枝加葛根汤</th>\n",
       "      <th>桂枝加附子汤</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>六经</th>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>原文</th>\n",
       "      <td>{'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...</td>\n",
       "      <td>{'对应证原文': ['太阳病，项背强几几，反汗出恶风者，桂枝加葛根汤主之。', '太阳与阳...</td>\n",
       "      <td>{'对应证原文': ['太阳病，发汗，遂漏不止，其人恶风，小便难，四支微急，难以屈伸者，桂枝...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方</th>\n",
       "      <td>{'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}</td>\n",
       "      <td>{'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...</td>\n",
       "      <td>{'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>证</th>\n",
       "      <td>{'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...</td>\n",
       "      <td>{'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}</td>\n",
       "      <td>{'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                  桂枝汤  \\\n",
       "六经                            {'阴阳': '阳', '三经': '太阳'}   \n",
       "原文  {'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...   \n",
       "方     {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}   \n",
       "证   {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...   \n",
       "\n",
       "                                               桂枝加葛根汤  \\\n",
       "六经                            {'阴阳': '阳', '三经': '太阳'}   \n",
       "原文  {'对应证原文': ['太阳病，项背强几几，反汗出恶风者，桂枝加葛根汤主之。', '太阳与阳...   \n",
       "方   {'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...   \n",
       "证                 {'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}   \n",
       "\n",
       "                                               桂枝加附子汤  \n",
       "六经                            {'阴阳': '阳', '三经': '太阳'}  \n",
       "原文  {'对应证原文': ['太阳病，发汗，遂漏不止，其人恶风，小便难，四支微急，难以屈伸者，桂枝...  \n",
       "方   {'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...  \n",
       "证   {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...  "
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "fang_list = ['桂枝汤','桂枝加葛根汤','桂枝加附子汤']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "六经                              {'阴阳': '阳', '三经': '太阳'}\n",
       "原文    {'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...\n",
       "方       {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}\n",
       "证     {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...\n",
       "Name: 桂枝汤, dtype: object"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.桂枝汤"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'阴阳': '阳', '三经': '太阳'}"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.桂枝汤[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'阳'"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.桂枝汤[0]['阴阳']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "桂枝汤       {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...\n",
       "桂枝加葛根汤                  {'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}\n",
       "桂枝加附子汤    {'体证': ['大量出汗不止', '怕风', '小便难', '四肢难以屈伸'], '脉证'...\n",
       "Name: 证, dtype: object"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.iloc[3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'鼻涕'"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.iloc[3]['桂枝汤']['体证'][1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['大量出汗不止', '怕风', '小便难', '四肢难以屈伸']"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.iloc[3]['桂枝汤':][2]['体证']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "大量出汗不止\n",
      "怕风\n",
      "小便难\n",
      "四肢难以屈伸\n"
     ]
    }
   ],
   "source": [
    "for i in sh1.iloc[3]['桂枝汤':][2]['体证']:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "metadata": {},
   "outputs": [],
   "source": [
    "a1 = pd.Series(sh1.iloc[3]['桂枝汤':][2]['体证'])#这里把一个切片给Series化了"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 171,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 171,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a1.isin(['小便难','怕风']).sum()#这个方法可以用多个证的list来找到答案"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 204,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 204,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a1.isin(['怕风']).sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'鼻涕'"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.桂枝汤[3]['体证'][1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 231,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.0"
      ]
     },
     "execution_count": 231,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.iloc[2]\n",
    "hi = pd.DataFrame(sh1.iloc[2])\n",
    "hi.方.str.contains('炙甘草').sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 235,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "桂枝汤         {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}\n",
       "桂枝加葛根汤    {'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...\n",
       "桂枝加附子汤    {'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...\n",
       "Name: 方, dtype: object"
      ]
     },
     "execution_count": 235,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi.方"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 218,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Shanghan():\n",
    "    def __init__(self):\n",
    "        pass\n",
    "        \n",
    "        \n",
    "    def bianzheng(self,zheng):#根据证输出对应方剂(简单根据伤寒的对应,而非根据心法)\n",
    "        self.zheng = zheng\n",
    "        n = 0\n",
    "        flag = False\n",
    "        for x in range(sh1.shape[1]):#一共有多少方剂,所有循环一遍\n",
    "            a = pd.Series(sh1.iloc[3]['桂枝汤':][x]['体证'])#从桂枝汤(第一个)往下的所有症状给做成一个series,方便用其功能\n",
    "            if a.isin(self.zheng).sum() > 1:\n",
    "                print(sh1.columns[x])\n",
    "            #elif a.isin(self.zheng).sum() == 1:#如果大于1,那么就是对上证\n",
    "                #print(sh1.columns[x])#显示是哪个经方\n",
    "                \n",
    "    def find(self,find):#简单查询某一个方剂的信息\n",
    "        self.find = find\n",
    "        print(sh1[self.find])\n",
    "        \n",
    "    def count_all(self,yao):#可以查询每个方剂或药物在整个伤寒里的统计\n",
    "        self.yao = yao\n",
    "        \n",
    "        pass\n",
    "    \n",
    "    def draw_dir(self):#画每一个方剂的方向图\n",
    "        pass\n",
    "        \n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 219,
   "metadata": {},
   "outputs": [],
   "source": [
    "br1 = Shanghan()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 184,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "六经                              {'阴阳': '阳', '三经': '太阳'}\n",
      "原文    {'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...\n",
      "方       {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}\n",
      "证     {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...\n",
      "Name: 桂枝汤, dtype: object\n"
     ]
    }
   ],
   "source": [
    "br1.find('桂枝汤')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 222,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "桂枝加葛根汤\n"
     ]
    }
   ],
   "source": [
    "br1.bianzheng(['肌肉酸痛','怕风'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 209,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "桂枝汤\n"
     ]
    }
   ],
   "source": [
    "br1.bianzheng(['干呕','头痛'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 206,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "桂枝加附子汤\n"
     ]
    }
   ],
   "source": [
    "br1.bianzheng(['怕风','小便难'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 221,
   "metadata": {},
   "outputs": [],
   "source": [
    "br1.bianzheng(['怕风'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "桂枝汤       {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...\n",
       "桂枝加葛根汤                  {'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}\n",
       "桂枝加附子汤    {'体证': ['大量出汗不止', '怕风', '小便难', '四肢难以屈伸'], '脉证'...\n",
       "Name: 证, dtype: object"
      ]
     },
     "execution_count": 112,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.iloc[3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>六经</th>\n",
       "      <th>原文</th>\n",
       "      <th>方</th>\n",
       "      <th>证</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>桂枝汤</th>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...</td>\n",
       "      <td>{'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}</td>\n",
       "      <td>{'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝加葛根汤</th>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'对应证原文': ['太阳病，项背强几几，反汗出恶风者，桂枝加葛根汤主之。', '太阳与阳...</td>\n",
       "      <td>{'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...</td>\n",
       "      <td>{'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂枝加附子汤</th>\n",
       "      <td>{'阴阳': '阳', '三经': '太阳'}</td>\n",
       "      <td>{'对应证原文': ['太阳病，发汗，遂漏不止，其人恶风，小便难，四支微急，难以屈伸者，桂枝...</td>\n",
       "      <td>{'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...</td>\n",
       "      <td>{'体证': ['大量出汗不止', '怕风', '小便难', '四肢难以屈伸'], '脉证'...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                             六经  \\\n",
       "桂枝汤     {'阴阳': '阳', '三经': '太阳'}   \n",
       "桂枝加葛根汤  {'阴阳': '阳', '三经': '太阳'}   \n",
       "桂枝加附子汤  {'阴阳': '阳', '三经': '太阳'}   \n",
       "\n",
       "                                                       原文  \\\n",
       "桂枝汤     {'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...   \n",
       "桂枝加葛根汤  {'对应证原文': ['太阳病，项背强几几，反汗出恶风者，桂枝加葛根汤主之。', '太阳与阳...   \n",
       "桂枝加附子汤  {'对应证原文': ['太阳病，发汗，遂漏不止，其人恶风，小便难，四支微急，难以屈伸者，桂枝...   \n",
       "\n",
       "                                                        方  \\\n",
       "桂枝汤       {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}   \n",
       "桂枝加葛根汤  {'葛根': 4, '桂枝': 3, '芍药': 2, '炙甘草': 2, '生姜': 3,...   \n",
       "桂枝加附子汤  {'附子': 1, '桂枝': 3, '芍药': 3, '炙甘草': 3, '生姜': 3,...   \n",
       "\n",
       "                                                        证  \n",
       "桂枝汤     {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...  \n",
       "桂枝加葛根汤                {'体证': ['肌肉酸痛', '怕风'], '脉证': ['无']}  \n",
       "桂枝加附子汤  {'体证': ['大量出汗不止', '怕风', '小便难', '四肢难以屈伸'], '脉证'...  "
      ]
     },
     "execution_count": 113,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "六经                              {'阴阳': '阳', '三经': '太阳'}\n",
       "原文    {'对应证原文': ['太阳中风，阳浮而阴弱，阳浮者热自发，阴弱者汗自出，啬啬恶寒，淅淅恶风...\n",
       "方       {'桂枝': 3, '芍药': 3, '炙甘草': 2, '生姜': 3, '大枣': 12}\n",
       "证     {'体证': ['发热', '鼻涕', '怕冷', '怕风', '干呕', '头痛', '出...\n",
       "Name: 桂枝汤, dtype: object"
      ]
     },
     "execution_count": 119,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.T.iloc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['桂枝汤', '桂枝加葛根汤', '桂枝加附子汤'], dtype='object')"
      ]
     },
     "execution_count": 120,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.T.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['六经', '原文', '方', '证'], dtype='object')"
      ]
     },
     "execution_count": 121,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'桂枝汤'"
      ]
     },
     "execution_count": 123,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.columns[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'阴阳': '阳', '三经': '太阳'}"
      ]
     },
     "execution_count": 137,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sh1.桂枝汤[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 237,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>土</th>\n",
       "      <th>金</th>\n",
       "      <th>火</th>\n",
       "      <th>水</th>\n",
       "      <th>木</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>味</th>\n",
       "      <td>甘甜</td>\n",
       "      <td>酸</td>\n",
       "      <td>咸</td>\n",
       "      <td>苦</td>\n",
       "      <td>辛辣</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>药物</th>\n",
       "      <td>[炙甘草, 人参, 大枣]</td>\n",
       "      <td>[芍药, 柴胡]</td>\n",
       "      <td>[大黄]</td>\n",
       "      <td>[地黄, 麻黄]</td>\n",
       "      <td>[干姜, 附子, 桂枝, 半夏]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                土         金     火         水                 木\n",
       "味              甘甜         酸     咸         苦                辛辣\n",
       "药物  [炙甘草, 人参, 大枣]  [芍药, 柴胡]  [大黄]  [地黄, 麻黄]  [干姜, 附子, 桂枝, 半夏]"
      ]
     },
     "execution_count": 237,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
